package com.sh.data.engine.common.constants.code;

/**
 * 业务代码
 *
 * @author: mengzheng.mhc
 * @date: 2024/5/24 11:37
 */
public class BizCodes {

    /**
     * 公共错误码
     */

    /**
     * 成功码
     */
    public static final BizCode SUCCESS = new BizCode(200, "success");

    /**
     * 请求错误
     */
    public static final BizCode REQUEST_ERROR = new BizCode(400, "request error");

    /**
     * 请求认证错误
     */
    public static final BizCode REQUEST_AUTH_ERROR = new BizCode(401, "request auth error");

    /**
     * 请求被拒绝
     */
    public static final BizCode REQUEST_FORBIDDEN = new BizCode(403, "request forbidden");

    /**
     * 请求被限流
     */
    public static final BizCode TOO_MANY_REQUESTS = new BizCode(429, "too many requests");

    /**
     * 请求参数错误
     */
    public static final BizCode REQUEST_PARAMETER_ERROR = new BizCode(460, "request parameter error");

    /**
     * 服务端内部错误
     */
    public static final BizCode INTERNAL_SERVER_ERROR = new BizCode(500, "internal server error");

    /**
     * 引擎通用错误码（4000~4499）
     */

    /**
     * 日志文件不存在
     */
    public static final BizCode LOG_FILE_NOT_EXISTS_ERROR = new BizCode(4400, "log file not exists");

    /**
     * 导出excel文件异常
     */
    public static final BizCode EXPORT_EXCEL_FILE_ERROR = new BizCode(4401, "export excel file error");

    /**
     * 模板文件不存在
     */
    public static final BizCode TEMPLATE_FILE_NOT_EXISTS = new BizCode(4402, "template file not exists");

    /**
     * 模板文件下载异常
     */
    public static final BizCode TEMPLATE_FILE_DOWNLOAD_ERROR = new BizCode(4403, "template file download error");

    /**
     * 导入excel文件异常
     */
    public static final BizCode IMPORT_EXCEL_FILE_ERROR = new BizCode(4404, "import excel file error");

    /**
     * 不支持的文件类型
     */
    public static final BizCode UNSUPPORTED_FILE_FORMAT = new BizCode(4405, "unsupported file format");

    /**
     * 无访问权限
     */
    public static final BizCode NO_ACCESS_PERMISSION = new BizCode(4406, "no access permission");

    /**
     * 数据集成错误码（4500~4999）
     */

    /**
     * 数据源类型无效
     */
    public static final BizCode DS_TYPE_INVALID_ERROR = new BizCode(4500, "data source type invalid");

    /**
     * 数据源名称已存在
     */
    public static final BizCode DS_NAME_ALREADY_EXISTS_ERROR = new BizCode(4501, "data source name already exists");

    /**
     * 数据源不存在
     */
    public static final BizCode DS_NOT_EXISTS_ERROR = new BizCode(4502, "data source not exists");

    /**
     * 连接失败
     */
    public static final BizCode DS_CONNECTION_FAILED = new BizCode(4503, "data source connection failed");

    /**
     * schema不存在
     */
    public static final BizCode SCHEMA_NOT_FOUND = new BizCode(4504, "schema not found");

    /**
     * 服务器或端口包含空格
     */
    public static final BizCode INVALID_DS_LINK_ERROR = new BizCode(4504, "data source link contains whitespace");

    /**
     * 存储源名称已存在
     */
    public static final BizCode STORAGE_NAME_ALREADY_EXISTS_ERROR = new BizCode(4510, "storage name already exists");

    /**
     * JDBC URL格式错误
     */
    public static final BizCode INVALID_JDBC_URL_ERROR = new BizCode(4511, "invalid jdbc url");

    /**
     * 不支持非hive2连接
     */
    public static final BizCode UNSUPPORTED_HIVE_CONNECTION = new BizCode(4512, "only hive2 connection is supported");

    /**
     * 存储类型和JDBC URL中指定的类型不一致
     */
    public static final BizCode MISMATCH_STORAGE_AND_JDBC_URL = new BizCode(4513, "storage type and jdbc url mismatch");

    /**
     * 存储源不存在
     */
    public static final BizCode STORAGE_NOT_FOUND = new BizCode(4514, "storage not found");

    /**
     * 加密数据库密码失败
     */
    public static final BizCode ENCRYPT_PASSWORD_FAILED = new BizCode(4515, "encrypt password failed");

    /**
     * 规范设计错误码（5000~5499）
     */

    /**
     * 删除维度表和事实表报错
     */
    public static final BizCode DELETE_DIMFACT_ERROR = new BizCode(5000, "delete dimfact record error");

    /**
     * 插入维度表和事实表报错
     */
    public static final BizCode INSERT_DIMFACT_ERROR = new BizCode(5001, "insert dimfact record error");

    /**
     * 维度表和事实表不存在
     */
    public static final BizCode DIMFACT_NOT_FOUND_ERROR = new BizCode(5002, "dimfact not found");

    /**
     * 关联模型不存在
     */
    public static final BizCode MODEL_NOT_ERROR = new BizCode(5003, "model not found");

    /**
     * 记录已经设置关联字段，禁止切换主题
     */
    public static final BizCode THEME_BINDING_ALREADY_EXISTS_ERROR = new BizCode(5004, "theme binding already exists");

    /**
     * 记录已经设置关联表，禁止修改关联表
     */
    public static final BizCode REL_TABLE_BINDING_ALREADY_EXISTS_ERROR = new BizCode(5005, "rel table binding already exists");

    /**
     * 切换主题时发生异常
     */
    public static final BizCode CHANGE_THEME_ERROR = new BizCode(5006, "change theme error");

    /**
     * 取消总线矩阵逻辑关系失败
     */
    public static final BizCode CANCEL_MATRIX_LOGICAL_REL_ERROR = new BizCode(5007, "cancel matrix logical rel error");

    /**
     * 字典映射详情不存在
     */
    public static final BizCode DICTIONARY_MAPPING_DETAIL_NOT_FOUND_ERROR = new BizCode(5008, "dictionary mapping detail not found");

    /**
     * 字典未发布
     */
    public static final BizCode DICTIONARY_IS_NOT_PUBLISHED = new BizCode(5009, "dictionary is not published");

    /**
     * 已发布的字典不允许删除
     */
    public static final BizCode PUBLISHED_DICTIONARY_NOT_ALLOWED_TO_DELETE = new BizCode(5010, "published dictionary not allowed to delete");

    /**
     * 已发布字典才可以下线
     */
    public static final BizCode ONLY_PUBLISHED_DICTIONARY_CAN_BE_RELEASED = new BizCode(5011, "only published dictionary can be released");

    /**
     * 字典英文名称已存在
     */
    public static final BizCode DICT_ENGLISH_NAME_ALREADY_EXISTS_ERROR = new BizCode(5012, "dict english name already exists");

    /**
     * 字典中文名称已存在
     */
    public static final BizCode DICT_CHINESE_NAME_ALREADY_EXISTS_ERROR = new BizCode(5013, "dict chinese name already exists");

    /**
     * 字典字段更新失败
     */
    public static final BizCode DICT_UPDATE_ERROR = new BizCode(5014, "dict update error");

    /**
     * 数据集成错误码（5500~5999）
     */

    /**
     * 数据开发错误码（6000~6499）
     */

    /**
     * 数据治理错误码（6500~6999）
     */

    /**
     * 数据质量规则异常
     */
    public static final BizCode DATA_QUALITY_RULE_EXCEPTION_ERROR = new BizCode(6500, "data quality rule exception");

    /**
     * 数据质量sql语句错误
     */
    public static final BizCode DATA_QUALITY_SQL_STATEMENT_ERROR = new BizCode(6501, "data quality sql statement error");

    /**
     * 系统管理（7000~7499）
     */

    /**
     * 用户与空间关联关系不存在
     */
    public static final BizCode NO_MATCHING_RECORD_ERROR = new BizCode(6502, "no matching record found for userId and projectId");

    /**
     * 无权限编辑或删除角色
     */
    public static final BizCode NO_PERMISSION_TO_EDIT_ROLE = new BizCode(6503, "no permission to edit or delete role");

    /**
     * 用户在该空间无角色关联
     */
    public static final BizCode ROLE_NOT_FOUND_ERROR = new BizCode(6504, "role not found");

    /**
     * 项目名称已存在
     */
    public static final BizCode PROJECT_NAME_ALREADY_EXISTS_ERROR = new BizCode(6505, "project name already exists");
}
